<?php 

 $username = "admin"; 
 $password = "1234"; 
	$wp_url = 'http://localhost/wpamazon';    // e.g. http://www.boxoft.net
	//$wp_url = 'http://car.2supercar.co.cc';    // e.g. http://www.boxoft.net
	
	
require_once("lib/IXR_Library.php.inc");
echo $script_path=$_SERVER[HTTP_REFERER];

$wp_xmlrpc_url = $wp_url.'/xmlrpc.php';
 
$client = new IXR_Client($wp_xmlrpc_url);
 
$image['name'] = 'gallery_thumb.jpg';    // e.g. trolley.jpg
$image['type'] = 'image/jpeg';    // e.g. image/jpeg
$image['bits'] = new IXR_Base64(file_get_contents($script_path.'images/'.$image['name']));    // e.g. /var/www/trolley.jpg
$image['overwrite'] = true;

//print_r($_SERVER);
 
if (!$client->query('wp.uploadFile', '',$username , $password, $image))
{
  die('An error occurred - ' . $client->getErrorCode() . ":" . $client->getErrorMessage());
}
else
{
  $response = $client->getResponse();
  print_r($reponse);
  echo '<img src="'.$response['url'].'" />';
}
?>